package com.eternal.base.concat;

import androidx.room.Ignore;
import androidx.annotation.NonNull;

import java.util.List;

/**
 * Created by Administrator
 * On 2020/5/6
 * Description:
 * @author Administrator
 */
public class DeviceModel implements Cloneable{
    public boolean isDegree;

    public int tmp;

    public int hum;

    public int fan;

    public byte fanState;
    public byte humState;
    public byte tmpState;
    /**
     * 控制页面是否是湿度  true湿度  false 温度
     */
    public boolean isControlTypeByHum;
    /**
     * 设备的工作模式
     */
    public byte workType;
    /**
     * On模式的Speed
     */
    public byte typeOn;
    /**
     * Off模式的Speed
     */
    public byte typeOff;
    /**
     * TimeToOn的Index
     */
    public char timeOn;
    /**
     * TimeToOff的Index
     */
    public char timeOff;
    /**
     * CycleToOn的index
     */
    public char cycleOn;
    /**
     * CycleToOff的index
     */
    public char cycleOff;
    /**
     * SchedToOn的index
     */
    public char schedOn;
    /**
     * SchedToOff的index
     */
    public char schedOff;
    /**
     * Auto的Hum的Start
     */
    public byte autoHighHum;
    /**
     * Auto的Hum的End
     */
    public byte autoLowHum;
    /**
     * Auto的TmpC的Start
     */
    public byte autoHighTmp;
    /**
     * Auto的TmpC的End
     */
    public byte autoLowTmp;
    /**
     * Auto高温出发开关
     */
    public boolean autoHighTmpSwitch;
    /**
     * Auto低温出发开关
     */
    public boolean autoLowTmpSwitch;
    /**
     * Auto高湿出发开关
     */
    public boolean autoHighHumSwitch;
    /**
     * Auto低湿出发开关
     */
    public boolean autoLowHumSwitch;
    /**
     * 当前模式剩余时间
     */
    public int currentTypeResidueTime;
    /**
     * 当前模式ToOff还是On
     */
    public boolean currentTypeResidueOn;
    /**
     * 温湿度记录仪的当前时间。时间是从2020年1月1日0时0分到当前时间的分钟数。
     */
    @Ignore
    public long time;
    /**
     * 0x00:控制器的风扇档位 0x01:插座的开关 0x02:植物灯的亮度档位
     */
    public byte fanType;
    /**
     * E家族多个端口
     */
    @Ignore
    public List<PortInfo> portList;
    /**
     * 端口
     */
    public byte port;
    public byte choosePort;

    @NonNull
    @Override
    public DeviceModel clone() {
        DeviceModel model = null;
        try {
            model = (DeviceModel) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return model;
    }

    public DeviceTFP toTFP() {
        DeviceTFP result = new DeviceTFP();
        result.isDegree = isDegree;
        result.tmp = tmp;
        result.per = hum;
        result.fan = 1;
        result.tmpState = tmpState;
        result.humState = humState;
        result.choosePort = choosePort;
        result.portList = portList;
        result.fanType = fanType;
        return result;
    }
}
